package com.up.upzl.biz.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.up.upzl.base.service.impl.BaseServiceImpl;
import com.up.upzl.biz.domain.Area;
import com.up.upzl.biz.repository.AreaRepository;
import com.up.upzl.biz.service.AreaService;

@Service
public class AreaServiceImpl extends BaseServiceImpl<Area, Long> implements AreaService {

	@Autowired
	private AreaRepository areaRepository;

	/**
	 * 根据父级id查找城市
	 * 
	 * @param pid
	 *            父级ID
	 * @return 城市的信息
	 */
	@Override
	public List<Area> findByParentId(Long parentId) {
		return areaRepository.findByParentAreaId(parentId);
	}

	@Override
	public Area findByName(String name) {
		return areaRepository.findByName(name);
	}

}
